// Copyright (c) Appeon. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

namespace SnapObjects.Data
{
    /// <summary>
    ///     Represents an object used to create a GROUP BY clause.
    ///     A GROUP BY clause is a clause in the SELECT statement that divides the query result into groups of rows.
    /// </summary>
    public interface ISqlGroupBuilder : ISqlHavingBuilder
    {
        /// <summary>
        ///     Creates a GROUP BY clause and adds an array of SQL expressions (each expression specifies
        ///     a column or a non-aggregate calculation on a column).
        /// </summary>
        /// <param name="groupExpressions">
        ///     An array of SQL expressions (each expression specifies a column or a non-aggregate calculation on a column).
        /// </param>
        /// <returns>
        ///     Returns the current ISqlGroupBuilder object.
        /// </returns>
        ISqlGroupBuilder GroupBy(params string[] groupExpressions);

        /// <summary>
        ///     Creates a GROUP BY clause, and adds a raw SQL string containing one or more column expressions (each expression
        ///     specifies a column or a non-aggregate calculation on a column).
        /// </summary>
        /// <param name="groupClause">
        ///     A raw SQL string containing one or more column expressions (each expression specifies a column or a 
        ///     non-aggregate calculation on a column).
        /// </param>
        /// <returns>
        ///     Returns the current ISqlGroupBuilder object.
        /// </returns>
        ISqlGroupBuilder GroupBy(string groupClause);

        /// <summary>
        ///     Returns an ISqlHavingAndOr object that can be used to add a search condition to a group or an aggregate in the HAVING clause.
        /// </summary>
        /// <returns>
        ///     Returns the ISqlHavingAndOr object that can add a search condition to a group or an aggregate in the HAVING clause.
        /// </returns>
        ISqlHavingAndOr AsHaving();
    }
}
